home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / ClassDay.dxr / Internal_7_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.7 KB  |  104 lines

  1. property spriteNum, motion, location, row, undercard
  2. global foundation, getlist, equal, currentsel, godlist, points, stock, tableau, extras
  3.  
  4. on beginSprite me
  5.   if not listp(foundation) then
  6.     foundation = [:]
  7.   end if
  8.   row = determinerow()
  9.   foundation.addProp(row, new(script("card pile")))
  10.   location = sprite(spriteNum).loc
  11.   undercard = sprite(spriteNum - 8)
  12. end
  13.  
  14. on mouseDown me
  15.   if foundation[row].getcardcount() > 0 then
  16.     if spriteNum = foundation[row].getlastcard().spnum then
  17.       puppetSound(3, member("pick card", "100GPak Generic SFX"))
  18.       sprite(spriteNum).locZ = spriteNum + 1000
  19.       getlist = foundation[row]
  20.       motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  21.     end if
  22.     if foundation[row].getcardcount() > 1 then
  23.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  24.     end if
  25.   end if
  26. end
  27.  
  28. on moving me
  29.   if the mouseDown then
  30.     sprite(spriteNum).loc = the mouseLoc
  31.   else
  32.     if the mouseUp then
  33.       sprite(spriteNum).locZ = spriteNum
  34.       motion.forget()
  35.       abort()
  36.     end if
  37.   end if
  38. end
  39.  
  40. on mouseUp me
  41.   if equal then
  42.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  43.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  44.     sprite(spriteNum).member = member("empty", "playing cards")
  45.     godlist.addCard(currentsel)
  46.     sprite(spriteNum).loc = location
  47.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  48.     if not objectp(foundation[sprite(currentsel).row]) then
  49.       points = points - 10
  50.     end if
  51.     equal = 0
  52.     currentsel = 0
  53.     godlist = VOID
  54.     getlist = VOID
  55.     repeat with i = 93 to 96
  56.       if tableau[sprite(i).row].getcardcount() = 0 then
  57.         next repeat
  58.       end if
  59.       sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  60.     end repeat
  61.     checkwin()
  62.   else
  63.     if not equal then
  64.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  65.       getlist = VOID
  66.       sprite(spriteNum).loc = location
  67.     end if
  68.   end if
  69. end
  70.  
  71. on determinerow me
  72.   if spriteNum = 77 then
  73.     return #fone
  74.   else
  75.     if spriteNum = 78 then
  76.       return #ftwo
  77.     else
  78.       if spriteNum = 79 then
  79.         return #fthree
  80.       else
  81.         if spriteNum = 80 then
  82.           return #ffour
  83.         else
  84.           if spriteNum = 81 then
  85.             return #ffive
  86.           else
  87.             if spriteNum = 82 then
  88.               return #fsix
  89.             else
  90.               if spriteNum = 83 then
  91.                 return #fseven
  92.               else
  93.                 if spriteNum = 84 then
  94.                   return #feight
  95.                 end if
  96.               end if
  97.             end if
  98.           end if
  99.         end if
  100.       end if
  101.     end if
  102.   end if
  103. end
  104.